/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.com.cotelasa.scp.entidad;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Jorge
 */

@Entity
@Table(name = "venta_detalle_nota_debito",catalog = "bdcotelasa", schema = "cotelasa")
@NamedQueries({
    @NamedQuery(name = "VentaDetalleNotaDebito.findAll", query = "SELECT v FROM VentaDetalleNotaDebito v"),
    @NamedQuery(name = "VentaDetalleNotaDebito.findByCodnditem", query = "SELECT v FROM VentaDetalleNotaDebito v WHERE v.codnditem = :codnditem"),
    @NamedQuery(name = "VentaDetalleNotaDebito.findByDescripcion", query = "SELECT v FROM VentaDetalleNotaDebito v WHERE v.descripcion = :descripcion"),
    @NamedQuery(name = "VentaDetalleNotaDebito.findByImporte", query = "SELECT v FROM VentaDetalleNotaDebito v WHERE v.importe = :importe")})
public class VentaDetalleNotaDebito implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @SequenceGenerator(name = "generadorVentaDetalleNotaDebito", sequenceName = "cotelasa.venta_detalle_nota_debito_id_seq")
    @GeneratedValue(generator = "generadorVentaDetalleNotaDebito") 
    @Basic(optional = false)
    @Column(name = "codnditem")
    private Integer codnditem;
    @Column(name = "descripcion")
    private String descripcion;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "importe")
    private Double importe;
    @JoinColumn(name = "codnd", referencedColumnName = "codnd")
    @ManyToOne(fetch=FetchType.LAZY)
    private VentaNotaDebito codnd;

    public VentaDetalleNotaDebito() {
    }

    public VentaDetalleNotaDebito(Integer codnditem) {
        this.codnditem = codnditem;
    }

    public Integer getCodnditem() {
        return codnditem;
    }

    public void setCodnditem(Integer codnditem) {
        this.codnditem = codnditem;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public Double getImporte() {
        return importe;
    }

    public void setImporte(Double importe) {
        this.importe = importe;
    }

    public VentaNotaDebito getCodnd() {
        return codnd;
    }

    public void setCodnd(VentaNotaDebito codnd) {
        this.codnd = codnd;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codnditem != null ? codnditem.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof VentaDetalleNotaDebito)) {
            return false;
        }
        VentaDetalleNotaDebito other = (VentaDetalleNotaDebito) object;
        if ((this.codnditem == null && other.codnditem != null) || (this.codnditem != null && !this.codnditem.equals(other.codnditem))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "prueba.VentaDetalleNotaDebito[ codnditem=" + codnditem + " ]";
    }
    
}
